var path =require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports={
    entry:path.resolve(__dirname, "./src/index.js"),
    output:{
        path:path.resolve(__dirname,'dist'),
        filename:"bundle.js"
    },
    devtool:"sourcemap",
    module:{
        rules:[{
            test:/.jsx?$/,
            exclude: /node_modules/,
            use:['babel-loader']
        },{
            test: /\.less$/,
            use: [{
                loader: "style-loader" // creates style nodes from JS strings
            }, {
                loader: "css-loader" // translates CSS into CommonJS
            }, {
                loader: "less-loader" // compiles Less to CSS
            }]
        }]
    },
    resolve: {
      alias:{
        SocketClient: path.resolve(__dirname, 'node_modules/socket.io-client/dist/')
      }
    },
    plugins: [new HtmlWebpackPlugin({
        filename: 'index.html',
        template: 'src/index.html',
        title: '大屏-多区域单独控制',
        hash: true
    })],
    externals: {
        jquery: 'window.jQuery',
        $: 'window.jQuery'
    },
    devServer: {
        contentBase: path.join(__dirname, "dist"),
        compress: true,
        port: 9000,
        host: "0.0.0.0"
    }

}